const Banner = require("./models/Banner");

exports.getBanner = async () => {
    const res = await Banner.findAll();
    return JSON.parse(JSON.stringify(res));
}

exports.setBanner = async (banners) => {
    await Banner.destroy({
        truncate: true
    });
    await Banner.bulkCreate(banners);
    const res = await Banner.findAll();
    return JSON.parse(JSON.stringify(res));
}